"""封装request请求"""
import requests
from lib.logger import Logger


from lib.config import config


class http_client(object):
    logger=Logger()

    def __init__(self):
        self.http_client = requests.Session()

    def request(self,path,**kwargs):
        self.logger.debug(f"请求接口是：{path}")
        self.logger.debug(f"请求参数是：{kwargs}")
        r=self.http_client.request(url=config["base"]["base_url"]+path,**kwargs)
        self.logger.debug(f"接口返回参数：{r.json()}")
        return r

    def updateHeaders(self,headers):
        self.http_client.headers.update(headers)